//-----------------------------------------------------------------------
// <copyright file="AdjustQuantityService.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using MyFramework;
using MIMS.WRS.Entities;
using MIMS.WRS.Data;
    
namespace MIMS.WRS.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class AdjustQuantityService
    {
		public static AdjustQuantityCollection GetAdjustQuantities(int bulkOrderID)
		{            
			try
			{
				AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
				return adjustQuantityDAO.GetAdjustQuantities(bulkOrderID);
			}
			catch (BusinessException)
			{
				throw;
			}
			catch (Exception ex)
			{
				// log this exception
				Logger.Error(ex);
				// wrap it and rethrow
				throw new BusinessException(SR.BusinessGetAdjustQuantitiesException, ex);
			}
		}        


        #region AdjustQuantity

        public static void CreateAdjustQuantity(AdjustQuantity adjustQuantity)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                adjustQuantityDAO.CreateAdjustQuantity(adjustQuantity);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateAdjustQuantityException, ex);
            }
        }        

        public static void UpdateAdjustQuantity(AdjustQuantity adjustQuantity)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                adjustQuantityDAO.UpdateAdjustQuantity(adjustQuantity);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateAdjustQuantityException, ex);
            }
        }        

        public static void DeleteAdjustQuantity(int adjustQuantityID)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                adjustQuantityDAO.DeleteAdjustQuantity(adjustQuantityID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteAdjustQuantityException, ex);
            }
        }
        
        public static AdjustQuantity GetAdjustQuantity(int adjustQuantityID)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                return adjustQuantityDAO.GetAdjustQuantity(adjustQuantityID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetAdjustQuantityException, ex);
            }
        }                

        public static AdjustQuantityCollection GetAdjustQuantities(AdjustQuantityColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                return adjustQuantityDAO.GetAdjustQuantities(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetAdjustQuantitiesException, ex);
            }
        }        

        public static AdjustQuantityCollection GetAdjustQuantities(AdjustQuantityColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                AdjustQuantityDAO adjustQuantityDAO = new AdjustQuantityDAO();
                return adjustQuantityDAO.GetAdjustQuantities(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetAdjustQuantitiesException, ex);
            }
        }        

        #endregion
    }
}